
$(mailist)

function refresh(){
	mailist();
}
var psid = param.psid;
var dataHand = new AjaxHandler();
function mailist(){
	$.proAjax({
		url: "/mobile/listmaipro",
		data: {keywords:$("#keywords").val()},
		success: function (data) {
			dataHand.arrayAddToHtml("models",data,"otherid",function(elm,row){
				(function(e,d){
					e.on("click",function(){
						$("#keywords").val("");
						delete param.usersel;
			        	router.href("tongxunEdit.html?mailid="+d,true);
			        });
				}(elm.find(".userList"),row.mailid));
				(function(e,d){
					e.on("click",function(){
			        	router.href("tongxunEdit.html?mailid="+d,{usersel:"setuser"});
			        });
				}(elm.find(".mui-btn").eq(0),row.mailid));
			});
			//刪除
			$(".deleteBtn").on("click",function(){
				var id = $(this).parent().prev().text();
				$.proAjax({
					url: "/mobile/deleteEmail",
					data: {id:id},
					success: function (data) {
						mailist();
					}
				});
			})
			
		}

	});
}


